{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3051
  Verdict: Accepted
}
uses 
	SysUtils, Math;
 
var
	n:longint;
 
procedure go(t,k:longint);
begin
if t=1 then begin
	if k=1 then begin
		writeln('1 1 2');
		writeln('1 2 3');
	end else begin
		go(1,k-1);
		writeln(k,' 1 2');
		go(-1,k-1);
		writeln(k,' 2 3');
		go(1,k-1);
	end;
end else begin
	if k=1 then begin
		writeln('1 3 2');
		writeln('1 2 1');
	end else begin
		go(-1,k-1);
		writeln(k,' 3 2');
		go(1,k-1);
		writeln(k,' 2 1');
		go(-1,k-1);
	end;
end;
end;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
go(1,n);
end.